home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / x11 / x-iso8859-1.el.z / x-iso8859-1.el
Encoding:
Text File  |  1998-05-21  |  7.2 KB  |  262 lines

  1. ;; Mapping between X keysym names and ISO 8859-1 (aka Latin1) character codes.
  2. ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify it
  7. ;; under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful, but
  12. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. ;; General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the 
  18. ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. ;; Boston, MA 02111-1307, USA.
  20.  
  21. ;; created by jwz, 13-jun-92.
  22. ;; changed by Heiko Muenkel, 12-jun-1997: Added a grave keysym.
  23.  
  24. ;; Under X, when the user types a character that is ISO-8859/1 but not ASCII,
  25. ;; it comes in as a symbol instead of as a character code.  This keeps things
  26. ;; nice and character-set independent.  This file takes all of those symbols
  27. ;; (the symbols that are the X names for the 8859/1 characters) and puts a
  28. ;; property on them which holds the character code that should be inserted in
  29. ;; the buffer when they are typed.  The self-insert-command function will look
  30. ;; at this.  It also binds them all to self-insert-command.
  31.  
  32. ;; It puts the same property on the keypad keys, so that (read-char) will
  33. ;; think that they are the same as the digit characters.  However, those
  34. ;; keys are bound to one-character keyboard macros, so that `kp-9' will, by
  35. ;; default, do the same thing that `9' does, in whatever the current mode is.
  36.  
  37. ;; The standard case and syntax tables are set in prim/iso8859-1.el, since
  38. ;; that is not X-specific.
  39.  
  40. (require 'iso8859-1)
  41.  
  42. (defconst iso8859/1-code-to-x-keysym-table nil
  43.   "Maps iso8859/1 to an X keysym name which corresponds to it.
  44. There may be more than one X name for this keycode; this returns the first one.
  45. Note that this is X specific; one should avoid using this table whenever 
  46. possible, in the interest of portability.")
  47.  
  48. ;; (This esoteric little construct is how you do MACROLET in elisp.  It
  49. ;; generates the most efficient code for the .elc file by unwinding the
  50. ;; loop at compile-time.)
  51.  
  52. ((macro
  53.   . (lambda (&rest syms-and-iso8859/1-codes)
  54.       (cons
  55.        'progn
  56.        (nconc
  57.     ;;
  58.     ;; First emit code that puts the `x-iso8859/1' property on all of
  59.     ;; the keysym symbols.
  60.     ;; 
  61.     (mapcar '(lambda (sym-and-code)
  62.            (list 'put (list 'quote (car sym-and-code))
  63.              ''x-iso8859/1 (car (cdr sym-and-code))))
  64.         syms-and-iso8859/1-codes)
  65.     ;;
  66.     ;; Then emit code that binds all of those keysym symbols to
  67.     ;; `self-insert-command'.
  68.     ;; 
  69.     (mapcar '(lambda (sym-and-code)
  70.            (list 'global-set-key (list 'quote (car sym-and-code))
  71.              ''self-insert-command))
  72.         syms-and-iso8859/1-codes)
  73.     ;;
  74.     ;; Then emit the value of iso8859/1-code-to-x-keysym-table.
  75.     ;;
  76.     (let ((v (make-vector 256 nil)))
  77.       ;; the printing ASCII chars have 1-char names.
  78.       (let ((i 33))
  79.         (while (< i 127)
  80.           (aset v i (intern (make-string 1 i)))
  81.           (setq i (1+ i))))
  82.       ;; these are from the keyboard character set.
  83.       (mapcar '(lambda (x) (aset v (car x) (car (cdr x))))
  84.           '((8 backspace) (9 tab) (10 linefeed) (13 return)
  85.             (27 escape) (32 space) (127 delete)))
  86.       (mapcar '(lambda (sym-and-code)
  87.              (or (aref v (car (cdr sym-and-code)))
  88.              (aset v (car (cdr sym-and-code)) (car sym-and-code))))
  89.           syms-and-iso8859/1-codes)
  90.       (list (list 'setq 'iso8859/1-code-to-x-keysym-table v)))
  91.     ))))
  92.  
  93.  ;; The names and capitalization here are as per the MIT X11R4 and X11R5
  94.  ;; distributions.  If a vendor varies from this, adjustments will need
  95.  ;; to be made...
  96.  
  97.  (grave            ?\140)
  98.  (nobreakspace        ?\240)
  99.  (exclamdown        ?\241)
  100.  (cent            ?\242)
  101.  (sterling        ?\243)
  102.  (currency        ?\244)
  103.  (yen            ?\245)
  104.  (brokenbar        ?\246)
  105.  (section         ?\247)
  106.  (diaeresis        ?\250)
  107.  (copyright        ?\251)
  108.  (ordfeminine        ?\252)
  109.  (guillemotleft        ?\253)
  110.  (notsign        ?\254)
  111.  (hyphen        ?\255)
  112.  (registered        ?\256)
  113.  (macron        ?\257)
  114.  (degree        ?\260)
  115.  (plusminus        ?\261)
  116.  (twosuperior        ?\262)
  117.  (threesuperior        ?\263)
  118.  (acute            ?\264)    ; Why is there an acute keysym that is 
  119.  (mu            ?\265)    ; distinct from apostrophe/quote, but 
  120.  (paragraph        ?\266)    ; no grave keysym that is distinct from
  121.  (periodcentered    ?\267)    ; backquote? 
  122.  (cedilla        ?\270)  ; I've added the grave keysym, because it's
  123.  (onesuperior        ?\271)  ; used in x-compose (Heiko Muenkel).
  124.  (masculine        ?\272)
  125.  (guillemotright    ?\273)
  126.  (onequarter        ?\274)
  127.  (onehalf        ?\275)
  128.  (threequarters        ?\276)
  129.  (questiondown        ?\277)
  130.  
  131.  (Agrave        ?\300)
  132.  (Aacute        ?\301)
  133.  (Acircumflex        ?\302)
  134.  (Atilde        ?\303)
  135.  (Adiaeresis        ?\304)
  136.  (Aring            ?\305)
  137.  (AE            ?\306)
  138.  (Ccedilla        ?\307)
  139.  (Egrave        ?\310)
  140.  (Eacute        ?\311)
  141.  (Ecircumflex        ?\312)
  142.  (Ediaeresis        ?\313)
  143.  (Igrave        ?\314)
  144.  (Iacute        ?\315)
  145.  (Icircumflex        ?\316)
  146.  (Idiaeresis        ?\317)
  147.  (ETH            ?\320)
  148.  (Ntilde        ?\321)
  149.  (Ograve        ?\322)
  150.  (Oacute        ?\323)
  151.  (Ocircumflex        ?\324)
  152.  (Otilde        ?\325)
  153.  (Odiaeresis        ?\326)
  154.  (multiply        ?\327)
  155.  (Ooblique        ?\330)
  156.  (Ugrave        ?\331)
  157.  (Uacute        ?\332)
  158.  (Ucircumflex        ?\333)
  159.  (Udiaeresis        ?\334)
  160.  (Yacute        ?\335)
  161.  (THORN            ?\336)
  162.  (ssharp        ?\337)
  163.  
  164.  (agrave        ?\340)
  165.  (aacute        ?\341)
  166.  (acircumflex        ?\342)
  167.  (atilde        ?\343)
  168.  (adiaeresis        ?\344)
  169.  (aring            ?\345)
  170.  (ae            ?\346)
  171.  (ccedilla        ?\347)
  172.  (egrave        ?\350)
  173.  (eacute        ?\351)
  174.  (ecircumflex        ?\352)
  175.  (ediaeresis        ?\353)
  176.  (igrave        ?\354)
  177.  (iacute        ?\355)
  178.  (icircumflex        ?\356)
  179.  (idiaeresis        ?\357)
  180.  (eth            ?\360)
  181.  (ntilde        ?\361)
  182.  (ograve        ?\362)
  183.  (oacute        ?\363)
  184.  (ocircumflex        ?\364)
  185.  (otilde        ?\365)
  186.  (odiaeresis        ?\366)
  187.  (division        ?\367)
  188.  (oslash        ?\370)
  189.  (ugrave        ?\371)
  190.  (uacute        ?\372)
  191.  (ucircumflex        ?\373)
  192.  (udiaeresis        ?\374)
  193.  (yacute        ?\375)
  194.  (thorn            ?\376)
  195.  (ydiaeresis        ?\377)
  196.  
  197.  )
  198.  
  199. ((macro . (lambda (&rest syms-and-iso8859/1-codes)
  200.         (cons 'progn
  201.           (mapcar '(lambda (sym-and-code)
  202.                  (list 'put (list 'quote (car sym-and-code))
  203.                    ''x-iso8859/1 (car (cdr sym-and-code))))
  204.               syms-and-iso8859/1-codes))))
  205.  ;;
  206.  ;; Let's do the appropriate thing for some vendor-specific keysyms too...
  207.  ;; Apparently nobody agrees on what the names of these keysyms are.
  208.  ;;
  209.  (SunFA_Acute        ?\264)
  210.  (SunXK_FA_Acute    ?\264)
  211.  (Dacute_accent        ?\264)
  212.  (DXK_acute_accent    ?\264)
  213.  (hpmute_acute        ?\264)
  214.  (hpXK_mute_acute    ?\264)
  215.  (XK_mute_acute        ?\264)
  216.  
  217.  (SunFA_Grave         ?`)
  218.  (Dead_Grave         ?`)
  219.  (SunXK_FA_Grave     ?`)
  220.  (Dgrave_accent         ?`)
  221.  (DXK_grave_accent     ?`)
  222.  (hpmute_grave         ?`)
  223.  (hpXK_mute_grave     ?`)
  224.  (XK_mute_grave         ?`)
  225.  
  226.  (SunFA_Cedilla        ?\270)
  227.  (SunXK_FA_Cedilla    ?\270)
  228.  (Dcedilla_accent    ?\270)
  229.  (DXK_cedilla_accent    ?\270)
  230.  
  231.  (SunFA_Diaeresis    ?\250)
  232.  (SunXK_FA_Diaeresis    ?\250)
  233.  (hpmute_diaeresis    ?\250)
  234.  (hpXK_mute_diaeresis    ?\250)
  235.  (XK_mute_diaeresis    ?\250)
  236.  
  237.  (SunFA_Circum         ?^)
  238.  (Dead_Circum         ?^)
  239.  (SunXK_FA_Circum     ?^)
  240.  (Dcircumflex_accent     ?^)
  241.  (DXK_circumflex_accent     ?^)
  242.  (hpmute_asciicircum     ?^)
  243.  (hpXK_mute_asciicircum     ?^)
  244.  (XK_mute_asciicircum     ?^)
  245.  
  246.  (SunFA_Tilde         ?~)
  247.  (Dead_Tilde         ?~)
  248.  (SunXK_FA_Tilde     ?~)
  249.  (Dtilde         ?~)
  250.  (DXK_tilde         ?~)
  251.  (hpmute_asciitilde     ?~)
  252.  (hpXK_mute_asciitilde     ?~)
  253.  (XK_mute_asciitilde     ?~)
  254.  
  255.  (Dring_accent        ?\260)
  256.  (DXK_ring_accent    ?\260)
  257.  )
  258.  
  259. (provide 'x-iso8859-1)
  260.  
  261. ;;; x-iso8859-1.el ends here
  262.